import request from '@/utils/request.js'

export function pageQueryProjectFlow(params) {
  return request({
    url: '/api/projectFlow/pageQueryProjectFlow',
    method: 'get',
    params
  })
}

export function projectFlowInsert(data) {
  return request({
    url: '/api/projectFlow/insertPorjectFlow',
    method: 'post',
    data
  })
}

// 更新流程名称
export function updateProjectFlowName(data) {
  return request({
    url: '/api/projectFlow/updateProjectFlowName',
    method: 'post',
    data
  })
}

export function projectFlowUpdate(data) {
  return request({
    url: '/api/projectFlow/updateProjectFlow',
    method: 'post',
    data
  })
}


export function projectFlowDelete(data) {
  return request({
    url: '/api/projectFlow/deleteProjectFlow',
    method: 'delete',
    data
  })
}

export function projectFlowDetail(params) {
  return request({
    url: '/api/projectFlow/selectProjectFlowById',
    method: 'get',
    params
  })
}

// 保存分支、用例、流程
export function saveBranch(data) {
  return request({
    url: '/api/step/saveBranch',
    method: 'post',
    data
  })
}

// 获取分支、用例、流程详情
export function findInstanceOrBranchDetail(params) {
  return request({
    url: '/api/step/findInstanceOrBranchDetail',
    method: 'get',
    params
  })
}

// 获取分支、用例、流程详情
export function addBranchOrInstance(data) {
  return request({
    url: '/api/step/addBranchOrInstance',
    method: 'get',
    params: data
  })
}

// 获取创建节点的属性列表
export function getBaseInfoAttr(params) {
  return request({
    url: '/api/step/getBaseInfoAttr',
    method: 'get',
    params
  })
}

// 保存节点属性
export function saveBaseInfoAttr(data) {
  return request({
    url: '/api/step/saveBaseInfoAttr',
    method: 'post',
    data
  })
}

// 新增节点调用
export function addInfo(data) {
  return request({
    url: '/api/step/addInfo',
    method: 'post',
    data
  })
}

// 删除节点信息
export function delInfo(data) {
  return request({
    url: '/api/step/delInfo',
    method: 'post',
    data
  })
}


// 更新关系
export function line(data) {
  return request({
    url: '/api/step/line',
    method: 'post',
    data
  })
}

// 删除关系
export function delLine(data) {
  return request({
    url: '/api/step/delLine',
    method: 'post',
    data
  })
}

// 更新注释
export function changNotes(data) {
  return request({
    url: '/api/step/changNotes',
    method: 'post',
    data
  })
}

// 更新注释
export function sortNode(data) {
  return request({
    url: '/api/step/sortNode',
    method: 'post',
    data
  })
}

// 获取当前节点的下级
export function findChildren(params) {
  return request({
    url: '/api/step/findChildren',
    method: 'get',
    params
  })
}

// 获取当前流程步节点的上级
export function getParentNodeAttr (params) {
  return request({
    url: '/api/step/getParentNodeAttr',
    method: 'get',
    params
  })
}

// 更新画布内容
export function updateContentById(data) {
  return request({
    url: '/api/step/updateContentById',
    method: 'post',
    data
  })
}

// 导出工程
export function exportProject(data) {
  return request({
    url: '/api/step/exportProject',
    method: 'post',
    data
  })
}

// 流程导出
export function exportFlow(data) {
  return request({
    url: '/api/step/exportFlow',
    method: 'get',
    params: data
  })
}
//流程导入
export function importFlow(data) {
  return request({
    url: '/api/step/importFlow',
    method: 'post',
    data: data
  })
}